/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jomijushi.fid.dominio;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author miguel
 */
@Entity
@Table(name = "fid_pedido_venta", catalog = "fid", schema = "")
@NamedQueries({@NamedQuery(name = "FidPedidoVenta.findAll", query = "SELECT f FROM FidPedidoVenta f"), @NamedQuery(name = "FidPedidoVenta.findById", query = "SELECT f FROM FidPedidoVenta f WHERE f.id = :id"), @NamedQuery(name = "FidPedidoVenta.findBySaldo", query = "SELECT f FROM FidPedidoVenta f WHERE f.saldo = :saldo"), @NamedQuery(name = "FidPedidoVenta.findByTotal", query = "SELECT f FROM FidPedidoVenta f WHERE f.total = :total"), @NamedQuery(name = "FidPedidoVenta.findByCreatedAt", query = "SELECT f FROM FidPedidoVenta f WHERE f.createdAt = :createdAt"), @NamedQuery(name = "FidPedidoVenta.findByUpdatedAt", query = "SELECT f FROM FidPedidoVenta f WHERE f.updatedAt = :updatedAt")})
public class FidPedidoVenta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "saldo")
    private Double saldo;
    @Column(name = "total")
    private Double total;
    @Column(name = "created_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdAt;
    @Column(name = "updated_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updatedAt;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fidPedidoVentaId")
    private List<FidUsuarioRegistraPedido> fidUsuarioRegistraPedidoList;
    @JoinColumn(name = "fid_cliente_fid_persona_empresa_id", referencedColumnName = "fid_persona_empresa_id")
    @ManyToOne
    private FidCliente fidClienteFidPersonaEmpresaId;
    @JoinColumn(name = "fid_credito_venta_id", referencedColumnName = "id")
    @ManyToOne
    private FidCreditoVenta fidCreditoVentaId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fidPedidoVentaId")
    private List<FidItemVenta> fidItemVentaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fidPedidoVenta")
    private List<FidPedidoGeneraComprobanteVenta> fidPedidoGeneraComprobanteVentaList;

    public FidPedidoVenta() {
    }

    public FidPedidoVenta(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Double getSaldo() {
        return saldo;
    }

    public void setSaldo(Double saldo) {
        this.saldo = saldo;
    }

    public Double getTotal() {
        return total;
    }

    public void setTotal(Double total) {
        this.total = total;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public List<FidUsuarioRegistraPedido> getFidUsuarioRegistraPedidoList() {
        return fidUsuarioRegistraPedidoList;
    }

    public void setFidUsuarioRegistraPedidoList(List<FidUsuarioRegistraPedido> fidUsuarioRegistraPedidoList) {
        this.fidUsuarioRegistraPedidoList = fidUsuarioRegistraPedidoList;
    }

    public FidCliente getFidClienteFidPersonaEmpresaId() {
        return fidClienteFidPersonaEmpresaId;
    }

    public void setFidClienteFidPersonaEmpresaId(FidCliente fidClienteFidPersonaEmpresaId) {
        this.fidClienteFidPersonaEmpresaId = fidClienteFidPersonaEmpresaId;
    }

    public FidCreditoVenta getFidCreditoVentaId() {
        return fidCreditoVentaId;
    }

    public void setFidCreditoVentaId(FidCreditoVenta fidCreditoVentaId) {
        this.fidCreditoVentaId = fidCreditoVentaId;
    }

    public List<FidItemVenta> getFidItemVentaList() {
        return fidItemVentaList;
    }

    public void setFidItemVentaList(List<FidItemVenta> fidItemVentaList) {
        this.fidItemVentaList = fidItemVentaList;
    }

    public List<FidPedidoGeneraComprobanteVenta> getFidPedidoGeneraComprobanteVentaList() {
        return fidPedidoGeneraComprobanteVentaList;
    }

    public void setFidPedidoGeneraComprobanteVentaList(List<FidPedidoGeneraComprobanteVenta> fidPedidoGeneraComprobanteVentaList) {
        this.fidPedidoGeneraComprobanteVentaList = fidPedidoGeneraComprobanteVentaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FidPedidoVenta)) {
            return false;
        }
        FidPedidoVenta other = (FidPedidoVenta) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jomijushi.fid.dominio.FidPedidoVenta[id=" + id + "]";
    }

}
